function [ ] = find_chars( img, filter, connection )
    if nargin < 3
        connection = 8;
    end
    figure; imshow(img);
    bmg = logical(im2bw(img, graythresh(img)));
    figure; imshow(bmg);
    bmg = imclearborder(bmg, 8);
    figure; imshow(bmg);
    bmg = imfill(bmg, 'holes'); 
    figure; imshow(bmg);
    emg = imerode(bmg, filter);
    figure; imshow(emg);
    rmg = imreconstruct(emg, bmg, connection);
    figure; imshow(rmg);
    figure;
    imshow((bmg + rmg * 3) * 0.25);
end

